** import from shapefile that is the result of python script

// Get the path of the currently running do-file
local do_file_path `c(pwd)'

// Change the working directory to the location of the do-file
cd "`do_file_path'"

log using "log\output_do_prep_bh_grid.log", replace
* Your Stata commands here

import dbase using "local\gis_data\003_boundaries\fishnet_pt.dbf", clear

rename POINT_X lon
rename POINT_Y lat
rename *, lower

keep joinid-lat

g lon2 = lon * lon
g lat2 = lat * lat
* make sure dummy in Arc has 0's 
sum

rename joinid objectid

sum objectid

label variable gid_0 "Country code from admin shp : GADM v3.6"
label variable gid_1 "Adm lvl 1 code from admin shp : GADM v3.6"
label variable gid_2 "Adm lvl 2 code from admin shp : GADM v3.6"
label variable gid_3 "Adm lvl 3 code from admin shp : GADM v3.6"

label variable name_0 "Admin level 0 name from admin shp : GADM v3.6"
label variable name_1 "Admin level 1 name from admin shp : GADM v3.6"
label variable name_2 "Admin level 2 name from admin shp : GADM v3.6"
label variable name_3 "Admin level 3 name from admin shp : GADM v3.6"

label variable gid_0 "GID ID level 0 : GADM v3.6"
label variable gid_1 "GID ID level 1 : GADM v3.6"
label variable gid_2 "GID ID level 2 : GADM v3.6"
label variable gid_3 "GID ID level 3 : GADM v3.6"

label variable lon "Geo longitude of within centroid : calc"
label variable lon2 "Geo longitude squared of within centroid : calc"
label variable lat "Geo latitude of within centroid : calc"
label variable lat2 "Geo latitude squared of within centroid : calc"

local do_file_path `c(pwd)'

// Change the working directory to the location of the do-file
cd "`do_file_path'"

sort objectid
save "proc_data\GRID.dta", replace
log close
